<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title> 乐铺订单 - <?=SITE_NAME?> </title>

<?php include VIEWS.'header.html'?>

<script type="text/javascript">var totalprice = <?php echo intval($shopcar['totalprice'])?>;</script>
</head>
<body>

<?php include VIEWS.'validation.html'?>
<?php include VIEWS.'topbar.html'?>

<div id="content">

    <?php include VIEWS.'leftnav.html'?>

    <div id="right">

    <h1>乐铺订单</h1>
    <?php do_action('view_checkout_msg'); ?>

<?php if($code['checkout'] == 1):
    do_action('view_shopcar_checkout_success', array('id'=>$indentid));
?>
	<meta http-equiv="refresh" content="5;url=/pay.php/<?php echo $indentid?>/1" />
    <div class="goodbox roundNormal">&nbsp;&nbsp;&nbsp;您的订单已经提交完毕! 订单号为 <font class="white"><?php echo $indentid?></font>，<a href="/pay.php/<?php echo $indentid?>/1">点击这里进行订单支付</a></div>
<?php else:?>

<?php if(count($shopcar['list'])):?>

    <?php if(!$session['login'] && !$session['wish']):?><div class="white goodbox roundNormal" style="width:90%">&nbsp;&nbsp;&nbsp;如果您已经是我们的会员，可以先 <a onclick="javascript:return login('_ll')" href="/login.php?from=%2Fcheckout.php" class="black">登录</a>，当然您完全可以不登录来继续完成您的订单。<a href='/faq/19' target='_blank' class="black">了解详情</a></div><br clear="all" /><?php endif?>
    <?php if($code['recheck'] === 8):?><div class="errbox roundNormal" style="width:90%">&nbsp;&nbsp;&nbsp;乐铺提醒：由于某些物品的库存不够，我们调整了您购物车中的数量。<a href='/faq/24' target='_blank' class="white">了解详情</a></div><br clear="all" /><?php endif?>
    <div id="updatemsg_div" style="display:none"><div class="updatemsg" id="updatemsg" style="font-weight:bold;background-color:#244890;font-size:12px;width:90%;">&nbsp;</div><br clear="all" /></div>
    <?php if($code['checkout'] & 4):?><div class="errbox roundNormal" style="width:90%">&nbsp;&nbsp;&nbsp;为保证物品能及时快捷的到达您的手中，请填写完整您的收货信息，谢谢!</div><?php endif?>

    <h3><img src="/images/icon_arrow_down.gif" />请确认您需要的物品清单：</h3>

    <div style="padding-left:10px">
        <?php echo round_table('96%', '244890', 'white', 3, 3, 'top')?>
        <table cellpadding="3" width="96%" cellspacing="0" border="0" style="margin-bottom:15px">
        <tr style="background-color:#244890;color:#FFF;font-weight:bold;font-size:14px"><td>&nbsp;物品名称</td><td>数量</td><td>价格</td></tr>

        <?php foreach($shopcar['list'] as $v):
        $checkout_i++;
        $_postfee += $v['postfee']; //额外运费
        ?>
        <tr class="px14" style="background:<?php echo $checkout_i%2==0 ? '#F9F9F9' : '#EEE'?>">
            <td style="padding:10px"><a href="/items/<?php echo $v['iid']?>" target="_blank"><?php echo $v['iname']?></a></td>
            <td width="20%"><?php echo $v['amount']?> × <?php echo $v['price']?></td>
            <td width="10%" nowrap="nowrap">&yen; <span id="price<?php echo $v['id']?>"><?php echo $v['amount']*$v['price']?></span></td>
        </tr>
        <?php endforeach?>
        
        <?php do_action('view_shopcar_checkout_itemlist_after', array('list'=>&$shopcar['list']));?>

        <tr>
            <td style="border-top:1px dotted #244890">
                <input style="background:url(/images/icon/icon_gift_small.gif) no-repeat;background-position:2px 50%;cursor:pointer" id="voucher_btn" type="button" class="px12" value="&nbsp; 我有礼品卡或优惠码" onclick="javascript:$('voucher_btn', 'voucher_area').invoke('toggle');$('voucher_code').focus();" />
                <div style="display:none" id="voucher_area" class="px12">
                    <form onsubmit="javascript:return change_voucher();">
                        <img src="/images/icon/icon_gift_small.gif" alt="Gift" align="absmiddle" /> 输入 <a href="/gift" title="什么是礼品卡?" target="_blank">礼品卡</a> 或优惠码:
                        <input name="voucher_code" size="15" type="text" class="px12" id="voucher_code" maxlength="20" />&nbsp;
                        <input id="voucher_btn_sub" type="submit" value="更新价格" class="px12" style="background:#FFF" />
                    </form>
                </div>
            </td>
            <td style="border-top:1px dotted #244890;">&nbsp;</td>
            <td style="border-top:1px dotted #244890;color:red" class="px12"><span id="voucher_price">&nbsp;</span></td>
        </tr>
        <tr><td colspan="3"><hr size="1" /></td></tr>
        <tr style="font-weight:bold;"><td>&nbsp;&nbsp; 小计：</td><td><span id="totalamount"><?php echo $shopcar['totalamount']?></span></td><td>&yen; <span id="totalprice"><?php echo $shopcar['totalprice']?></span></td></tr>
        </table>
    </div>

    <br clear="all" />

    <form action="/checkout.php" id="checkoutform" method="post">
    <input type="hidden" value="" name="voucher_code" id="voucher_code_h" />
    <?php do_action('view_checkout_ship', array('shopcar'=>$shopcar))?>

    <div id="posttype" style="margin-bottom:15px">
        <h3><img src="/images/icon_arrow_down.gif" />请选择您需要的送货方式</h3>
        <ul style="padding:0;margin-left:20px;list-style-type:none" class="l16">

        <?php
        //满 xx 元免费快递
        //if($shopcar['totalprice'] > 20000):

        //满 xx 件免费快递
        if($shopcar['totalamount'] >= 20000):
            $default_postfee = 0;
        ?>
        <li><input onclick="javascript:change_sumprice(0)" id="f0" type="radio" name="postfee" value="0" checked /><label for="f0" title="母亲节免费快递"><b>母亲节免费快递</b> (+0元)</label> &nbsp;&nbsp;&nbsp; <a class="px12" href="<?php echo $_servername?>/events/2006md.php" target="_blank">了解详情</a> </li>
        <?php
        else:
            $default_postfee = 12+$_postfee;

            $_f1 = 8  + $_postfee;
            $_f2 = 12 + $_postfee;
            $_f3 = 20 + $_postfee;
            $_f4 = 25 + $_postfee;

            //改邮费
            do_action('checkout_Postfee_Change', array('default'=>&$default_postfee, 'f1'=>&$_f1, 'f2'=>&$_f2, 'f3'=>&$_f3, 'f4'=>&$_f4));
        ?>
        <?php if($shopcar['totalprice']<100):?><li><input onclick="javascript:change_sumprice(<?php echo $_f1?>)" id="f<?php echo $_f1?>" type="radio" name="postfee" value="<?php echo $_f1?>" /> <label for="f<?php echo $_f1?>" title="通过中国邮政普通包裹发出，国内大中城市2-3周到货"> <b>邮政包裹</b> (+<?php echo $_f1?>元)</label> &nbsp;&nbsp;&nbsp;&nbsp; <small class="px12" style="color:blue">普通包裹，国内大中城市 2-3 周到货</small> </li><?php endif?>
        <li><input onclick="javascript:change_sumprice(<?php echo $_f2?>)" id="f<?php echo $_f2?>" type="radio" name="postfee" value="<?php echo $_f2?>" checked /> <label for="f<?php echo $_f2?>" title="申通快递，国内大中城市均有网点，2-3天到货"> <b>普通快递</b> (+<?php echo $_f2?>元)</label> &nbsp;&nbsp; <small class="px12" style="color:blue">国内大中城市均有网点，视远近 2-4 天送达，<font color="red">推荐!</font></small> </li>
        <li><input onclick="javascript:change_sumprice(<?php echo $_f3?>)" id="f<?php echo $_f3?>" type="radio" name="postfee" value="<?php echo $_f3?>" /> <label for="f<?php echo $_f3?>" title="国内大部分城市 48 小时内送达"> <b>次日达快递</b> (+<?php echo $_f3?>元)</label> &nbsp;&nbsp; <small class="px12" style="color:blue">国内主要城市有网点，一级城市 24 小时、二级以上城市 48 小时内送达，<font color="red">推荐!</font></small> </li>
        <li><input onclick="javascript:change_sumprice(<?php echo $_f4?>)" id="f<?php echo $_f4?>" type="radio" name="postfee" value="<?php echo $_f4?>" /> <label for="f<?php echo $_f4?>" title="中国邮政快递包裹，国内所有地区均可到达，视远近2天-1周到达"> <b>EMS 快递</b> (+<?php echo $_f4?>元)</label> &nbsp;&nbsp; <small class="px12" style="color:blue">国内所有地区均可到达，视远近 2天-1周 送达</small> </li>
        <li><input onclick="javascript:change_sumprice(0)" id="f0" type="radio" name="postfee" value="0" /> <label for="f0" title="福州本市上门自提"> <b>门店自取</b> (+0元)</label> &nbsp;&nbsp;&nbsp;&nbsp; <small class="px12" style="color:blue">限福州本地用户，</small><a class="px12" href="<?php echo $_servername?>/aboutus#map" target="_blank">乐铺的地址请参见</a> </li>
        <?php endif?>

        </ul>

    </div>

    <br clear="all" />

<?php if($address):?>
    <div id="choiseaddress">
    <h3><img src="/images/icon_arrow_down.gif" />请选择您的收货地址 <span style="font-size:12px">(下面都不是您要收货的地址? <a href="javascript:void(0)" onclick="javascript:$('choiseaddress', 'newaddress').invoke('toggle');">请输入新地址</a>)</span></h3>

    <ul style="padding:0;margin-left:20px;list-style-type:none" class="l16">
    <?php foreach($address as $v):?>
        <li><input id="a<?php echo $v['id']?>" type="radio" name="paddr" value="<?php echo $v['id']?>"<?php if($v['paddr']):?> checked<?php endif?> /></td><td> <label for="a<?php echo $v['id']?>"><b><?php echo $v['linkman']?></b></label> &nbsp;&nbsp; </td><td style="font-size:11px"> <label for="a<?php echo $v['id']?>"><?php echo $v['tel']?></label> </td><td> <label for="a<?php echo $v['id']?>"><?php echo $v['address']?><span style="font-size:11px">(<?php echo $v['zipcode']?>)</span></label></li>
    <?php endforeach?>
    </ul>
    </div>
<?php endif?>

<div id="newaddress"<?php if($address):?> style="display:none"<?php endif?>>
<h3><img src="/images/icon_arrow_down.gif" />请输入收货信息<?php if($address):?> <span style="font-size:12px">(<a href="javascript:void(0)" onclick="javascript:$('choiseaddress', 'newaddress').invoke('toggle');$('linkman','tel','address','zipcode').invoke('clear')">取消</a>)</span><?php endif?></h3>
<table width="100%" cellpadding="5">
    <tr><td width="10%">收货人 <font color="red">*</font> </td><td><input title="请填写收货人姓名" class="input1 required" onblur="javascript:if(!$F('cman'))$('cman').value=this.value" id="linkman" type="text" name="linkman" maxlength="30" size="10" value="<?php echo $data['linkman']?>" /></td></tr>
<tr><td>收货电话 <font color="red">*</font> </td><td><input title="请填写收货人电话" class="input1 required" onblur="javascript:if(!$F('cphone'))$('cphone').value=this.value" id="tel" type="text" name="tel" maxlength="20" size="12" value="<?php echo $data['tel']?>" /></td></tr>
<tr><td>邮编 <font color="red">*</font> </td><td><input title="请填写邮编" class="input0 required" id="zipcode" type="text" name="zipcode" maxlength="6" size="7" value="<?php echo $data['zipcode']?>" /></td></tr>
<tr><td>收货地址 <font color="red">*</font> </td><td><input title="请填写收货地址" class="input2 required" id="address" type="text" name="address" maxlength="100" size="46" value="<?php echo $data['address']?>" /></td></tr>
</table>
</div>

<script type="text/javascript">new Validation('checkoutform',{useTitles:true,stopOnFirst:true});</script>

<?php if($data['linkman'] || $data['tel'] || $data['address'] || $data['zipcode']):?><script type="text/javascript">try{$('choiseaddress', 'newaddress').invoke('toggle')} catch(e){}</script><?php endif?>

<br />

<div id="contactinfo">
<h3><img src="/images/icon_arrow_down.gif" />订单联系人信息</h3>
<table width="100%" cellpadding="5">
    <tr><td width="10%">联系人 <font color="red">*</font> </td><td nowrap="nowrap"><input title="请填写订单联系人" class="input1 required" id="cman" type="text" name="cman" maxlength="30" size="12" value="<?php echo $data['cman']?>" /></td><td rowspan="3" class="px12 l16" style="padding-left:10px;border-left:1px solid #CCC"><b>乐铺提示</b>：该信息不同于收货人信息。<br />当订单有问题的时候我们将通过这里的联系方式与您取得联系。<br /><b>推荐填写手机号码</b>，发货后可以第一时间得到短信通知。</td></tr>
    <tr><td>联系电话 <font color="red">*</font> </td><td nowrap="nowrap"><input title="请填写订单联系人电话" style="padding-right:.5em" class="input1 required" id="cphone" type="text" name="cphone" maxlength="20" size="12" value="<?php echo $data['cphone']?>" /></td></tr>
    <tr><td>联系 Email</td><td nowrap="nowrap"><input value="<?=$session['email']?>" title="请检查您的联系 Email" style="padding-right:.5em" class="input1 validate-email" id="cemail" type="text" name="cemail" maxlength="60" size="12" value="<?php echo $data['cphone']?>" /></td></tr>
</table>
</div>

<br />

<div id="packaging">
<h3><img src="/images/icon_arrow_down.gif" />免费礼品包装</h3>
<table width="100%">
<tr><td>
<input id="p1" type="radio" name="needpack" value="0" checked="checked" /><label for="p1">不需要包装</label> &nbsp; <input id="p2" type="radio" name="needpack" value="1" /><label for="p2">需要包装</label>&nbsp;
</td>
<td style="padding-left:10px;border-left:1px solid #CCC" class="px12 l16">
准备送给朋友吗？乐铺可以免费提供礼品包装。<br />
<b>注意：</b>由于邮寄的局限性，不规则产品无法提供该服务，请见谅~
</td></tr>
</table>
</div>

<br />

<h3><img src="/images/icon_arrow_down.gif" />如果您有特殊要求，请在这里注明</h3>
<textarea name="memo" rows="5" cols="60"><?php echo $data['memo']?></textarea>

<hr size="1" />
<h3>您一共需要支付 <span style="font-size:25px; color:#FF6600" id="sumprice"><?php echo $shopcar['totalprice']+$default_postfee?></span> 元</h3>
<input class="bluebtn" type="submit" style="font-weight:bold" value="好了，提交订单" />
<!--&nbsp;&nbsp; <a href="/shopcar" class="px12">要继续选购其它物品?</a>-->
</form>

<!--<script type="text/javascript">if (document.all) $('checkoutform').observe('submit', checkout_submit)</script>-->

<?php else:?>
<div class="errbox roundNormal">&nbsp;&nbsp;&nbsp;购物车中没有物品怎么下订单啊？来看看我们的 <a href="/whathot" class="white">热门物品</a> 吧！</div>
<?php endif?>

<?php endif?>

        <div style="text-align:right; margin-top:20px;">
        </div>

    </div>
</div>

<?php if ($session['wish']):?>
<script type="text/javascript">
try{$('choiseaddress').hide();$('newaddress').show();}catch(e){}
$('updatemsg').innerHTML = '&nbsp;&nbsp;&nbsp;由于您是通过 <?php echo $session['wish']['username']?> 的 WishList 过来的，我们已经自动为您填写了收货人地址，请核对……';
$('updatemsg_div').show();
new Effect.Round('div', 'updatemsg');
</script>
<?php endif?>

<img src="/images/input2.gif" width="0" height="0" />

<?php include VIEWS.'copyright.html'?>

<!-- $Id: checkout.html 9 2009-04-26 06:35:12Z bole.Chen $ -->
</body>
</html>
